package com.platform.modular.vehicle.controller;

import com.platform.core.pojo.page.PageResult;
import com.platform.core.pojo.response.ResponseData;
import com.platform.core.pojo.response.SuccessResponseData;
import com.platform.modular.vehicle.entity.AutohomeVehicleModel;
import com.platform.modular.vehicle.param.AutohomeVehicleModelParam;
import com.platform.modular.vehicle.service.AutohomeVehicleModelService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 车型表控制器
 *
 * @author gyp
 * @date 2025-01-13 14:31:03
 */
@RestController
public class AutohomeVehicleModelController {

    @Resource
    private AutohomeVehicleModelService autohomeVehicleModelService;

    /**
     * 查询车型表
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @GetMapping("/autohomeVehicleModel/page")
    public ResponseData<PageResult<AutohomeVehicleModel>> page(AutohomeVehicleModelParam autohomeVehicleModelParam) {
        return new SuccessResponseData(autohomeVehicleModelService.page(autohomeVehicleModelParam));
    }

    /**
     * 添加车型表
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @PostMapping("/autohomeVehicleModel/add")
    public ResponseData add(@RequestBody @Validated(AutohomeVehicleModelParam.add.class) AutohomeVehicleModelParam autohomeVehicleModelParam) {
            autohomeVehicleModelService.add(autohomeVehicleModelParam);
        return new SuccessResponseData();
    }

    /**
     * 删除车型表，可批量删除
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @PostMapping("/autohomeVehicleModel/delete")
    public ResponseData delete(@RequestBody @Validated(AutohomeVehicleModelParam.delete.class) List<AutohomeVehicleModelParam> autohomeVehicleModelParamList) {
            autohomeVehicleModelService.delete(autohomeVehicleModelParamList);
        return new SuccessResponseData();
    }

    /**
     * 编辑车型表
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @PostMapping("/autohomeVehicleModel/edit")
    public ResponseData edit(@RequestBody @Validated(AutohomeVehicleModelParam.edit.class) AutohomeVehicleModelParam autohomeVehicleModelParam) {
            autohomeVehicleModelService.edit(autohomeVehicleModelParam);
        return new SuccessResponseData();
    }

    /**
     * 查看车型表
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @GetMapping("/autohomeVehicleModel/detail")
    public ResponseData detail(@Validated(AutohomeVehicleModelParam.detail.class) AutohomeVehicleModelParam autohomeVehicleModelParam) {
        return new SuccessResponseData(autohomeVehicleModelService.detail(autohomeVehicleModelParam));
    }

    /**
     * 车型表列表
     *
     * @author gyp
     * @date 2025-01-13 14:31:03
     */
    @GetMapping("/autohomeVehicleModel/list")
    public ResponseData list(AutohomeVehicleModelParam autohomeVehicleModelParam) {
        return new SuccessResponseData(autohomeVehicleModelService.list(autohomeVehicleModelParam));
    }

}
